package com.loveprogrammer.lowercode.dna.party.dna;

import com.loveprogrammer.lowercode.dna.def.Dna;
import com.loveprogrammer.lowercode.dna.def.Vd;
import com.loveprogrammer.lowercode.dna.util.DateUtil;
import com.loveprogrammer.lowercode.dna.common.CodeDefConst;
import com.loveprogrammer.lowercode.dna.common.DataType;
import org.springframework.stereotype.Service;


public class PartyDnaTool {

    public static Dna getPartyDna(){
        Dna partyDna = new Dna(CodeDefConst.BUSINESS_TYPE_PARTY,CodeDefConst.DNA_CODE_PARTY,CodeDefConst.DNA_NAME_PARTY,"party结构dna");

        partyDna.setCategory(CodeDefConst.CATEGORY_PARTY);
        partyDna.setDbMapCode(CodeDefConst.DNA_DB_MAP_CODE_PARTY);
        partyDna.setCursive(false);
        partyDna.setLastTime(DateUtil.parse("2023-03-04 12:00:00",DateUtil.PATTERN_YYYY_MM_DD_HHMMSS));
        //  当事人
        partyDna.addVD(new Vd("partyCode","party 代码", DataType.DATA_TYPE_STRING));
        partyDna.addVD(new Vd("partyName","party 名称", DataType.DATA_TYPE_STRING));
        partyDna.addVD(new Vd("birthday","出生日期", DataType.DATA_TYPE_DATE));
        partyDna.addVD(new Vd("gender","性别", DataType.DATA_TYPE_STRING,CodeDefConst.GENDER_CODE));
        partyDna.addVD(new Vd("certType","证件类型", DataType.DATA_TYPE_STRING,CodeDefConst.CERT_TYPE));
        partyDna.addVD(new Vd("certId","证件号", DataType.DATA_TYPE_STRING,CodeDefConst.CERT_TYPE));
        partyDna.addVD(new Vd("certMobileNo","手机号", DataType.DATA_TYPE_STRING));
        // ...
        Dna partyAccountDna = getPartyAccountDna();

        partyDna.addChild(partyAccountDna);
        return partyDna;

    }

    public static Dna getPartyAccountDna() {
        Dna partyAccountDna = new Dna(CodeDefConst.BUSINESS_TYPE_PARTY,CodeDefConst.DNA_CODE_PARTY_ACCOUNT,CodeDefConst.DNA_NAME_PARTY_ACCOUNT,"partyAccount结构dna");

        partyAccountDna.setCategory(CodeDefConst.CATEGORY_PARTY);
        partyAccountDna.setDbMapCode(CodeDefConst.DNA_DB_MAP_CODE_PARTY_ACCOUNT);
        partyAccountDna.setCursive(false);
        partyAccountDna.setLastTime(DateUtil.parse("2023-03-04 12:00:00",DateUtil.PATTERN_YYYY_MM_DD_HHMMSS));
        //  账号
        partyAccountDna.addVD(new Vd("accountNo","账号", DataType.DATA_TYPE_STRING));
        partyAccountDna.addVD(new Vd("accountName","账号名称", DataType.DATA_TYPE_STRING));
        partyAccountDna.addVD(new Vd("bankName","银行名称", DataType.DATA_TYPE_DATE));
        partyAccountDna.addVD(new Vd("address","开户地址", DataType.DATA_TYPE_STRING));
        partyAccountDna.addVD(new Vd("postCode","邮编", DataType.DATA_TYPE_STRING));
        // ...
        Dna accounUsageDna = getAccounUsageDna();

        partyAccountDna.addChild(accounUsageDna);
        return partyAccountDna;

    }

    public static Dna getAccounUsageDna() {
        Dna accounUsageDna = new Dna(CodeDefConst.BUSINESS_TYPE_PARTY,CodeDefConst.DNA_CODE_ACCOUNT_USAGE,CodeDefConst.DNA_NAME_ACCOUNT_USAGE,"accountUsage结构dna");

        accounUsageDna.setCategory(CodeDefConst.CATEGORY_PARTY);
        accounUsageDna.setDbMapCode(CodeDefConst.DNA_DB_MAP_CODE_ACCOUNT_USAGE);
        accounUsageDna.setCursive(false);
        accounUsageDna.setLastTime(DateUtil.parse("2023-03-04 12:00:00",DateUtil.PATTERN_YYYY_MM_DD_HHMMSS));
        //  每日限额情况
        accounUsageDna.addVD(new Vd("usageDescription","用途说明", DataType.DATA_TYPE_STRING));
        accounUsageDna.addVD(new Vd("amountLimit","限额", DataType.DATA_TYPE_FLOAT));
        // ...
        return accounUsageDna;
    }
}
